package com.hj.mybatis.query;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

/**
 * @author hj
 * @Date 2023/4/27
 * @Description: 分页相关的公用参数
 */
@Data
public class BaseQuery {

    @NotNull(message = "页码不能为空")
    @Min(value = 1, message = "页码最小值为 1")
    @Schema(description = "当前页码")
    private Integer page;

    @NotNull(message = "每页条数不能为空")
    @Range(min = 1, max = 1000, message = "每页条数，取值范围 1-1000")
    @Schema(description = "每页条数")
    private Integer pageSize;

    @Schema(description = "排序字段")
    private String orderField;

    @Schema(description = "是否升序")
    private boolean asc;


}
